﻿@{
    VoteSystem.Models.UserInSession currentUser = Session["loginUser"] as VoteSystem.Models.UserInSession;
    string url = "/account/showvotelist";
    if( currentUser.RoleId == 1){
        url = "/config/import";
    }   
 }
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title>全员竞聘管理平台</title>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="~/css/bootstrap.min.css" />
    <link rel="stylesheet" href="~/css/bootstrap-responsive.min.css" />
    <link rel="stylesheet" href="~/css/matrix-style.css" />
    <link rel="stylesheet" href="~/css/matrix-media.css" />
    <link href="~/font-awesome/css/font-awesome.css" rel="stylesheet" />
</head>
<body>
    <!--Header-part-->
    <div id="header">
      <h1><a href="#">成都市教育技术装备管理中心 （2016年度）全员竞聘管理平台</a></h1>
    </div>
    <!--close-Header-part--> 

    <!--top-Header-menu-->
    <div id="user-nav" class="navbar navbar-inverse">
        <ul class="nav">
            <li  id="profile-messages" >
                <a title="" href="#" data-toggle="dropdown" data-target="#profile-messages" class="dropdown-toggle">
                    <i class="icon icon-user"></i>&nbsp;
                    <span class="text">欢迎你，<b style="color:#08c">@currentUser.UserName </b> </span>&nbsp;
                </a>
            </li>
            <li class=""><a title="" href="/account/logoff"><i class="icon icon-share-alt"></i> <span class="text" style="font-weight:bold;color:#08c">&nbsp;退出系统</span></a></li>
        </ul>
    </div>
    <!--close-top-Header-menu-->


    <!--sidebar-menu-->
    <div id="sidebar" style="OVERFLOW-Y: auto; OVERFLOW-X:hidden;">
        <ul>
            @if(currentUser.RoleId == 2){
            <li class="submenu active">
                <a class="menu_a" link="/account/showvotelist"><i class="icon icon-home"></i> <span>竞聘列表</span></a> 
            </li>
            }
            else
            {
                <li class="submenu active">
                    <a class="menu_a" link="/config/import"><i class="icon icon-home"></i><span>导入岗位数据</span></a>
                </li>
                <li class="submenu ">
                    <a class="menu_a" link="/config/importvotedata"><i class="icon icon-home"></i><span>导入竞聘数据</span></a>
                </li>
                <li class="submenu">
                    <a class="menu_a" link="/config/export"><i class="icon icon-home"></i><span>导出EXCEL</span></a>
                </li>
                <li class="submenu">
                    <a class="menu_a" link="/config/timeconfig"><i class="icon icon-home"></i><span>时间配置</span></a>
                </li>
                <li class="submenu">
                    <a class="menu_a" link="/config/showloginusers"><i class="icon icon-home"></i><span>在线记录</span></a>
                </li>
            }
            <li class="submenu">
                <a class="menu_a" link="/account/changepassword"><i class="icon icon-home"></i><span>修改密码</span></a>
            </li>
        </ul>
    </div>
    <!--sidebar-menu-->

    <!--main-container-part-->
    <div id="content">
      @*  <!--breadcrumbs-->
        <div id="content-header">
          <div id="breadcrumb"> <a href="index.html" title="Go to Home" class="tip-bottom"><i class="icon-home"></i> Home</a></div>
        </div>
        <!--End-breadcrumbs-->*@
        
        <iframe src="@url" id="iframe-main" frameborder='0' style="width:100%;"></iframe>
    </div>
    <!--end-main-container-part-->

    <script src="~/js/excanvas.min.js"></script> 
    <script src="~/js/jquery.min.js"></script> 
    <script src="~/js/jquery.ui.custom.js"></script> 
    <script src="~/js/bootstrap.min.js"></script> 
    <script src="~/js/nicescroll/jquery.nicescroll.min.js"></script> 
    <script src="~/js/matrix.js"></script> 


    <script type="text/javascript">
        function CallbackFunction(event) {

            if (window.event) {

                if (window.event.clientX < 40 && window.event.clientY < 0) {

                    console.log("back button is clicked");

                } else {

                    console.log("refresh button is clicked");
                }

            } else {

                if (event.currentTarget.performance.navigation.type == 2) {

                    console.log("back button is clicked");

                }
                if (event.currentTarget.performance.navigation.type == 1) {

                    console.log("refresh button is clicked");
                }
            }
        }

    //提示用户是否离开此页面（关闭、刷新或者点击后退等）

    window.addEventListener("beforeunload", function (e) {
        window.location.href = "/account/logoff";
        var confirmationMessage = '确定离开此页吗？';
        //(e || window.event).returnValue = confirmationMessage;     // Gecko and Trident
        //return confirmationMessage;                                // Gecko and WebKit
    });
    //window.addEventListener("unload", function (e) {
    //    //$.ajax({
    //    //    url: "/account/logoff",
    //    //    async: false,
    //    //    success: function () {
    //    //    }
    //    //});
    //    alert("即将离开页面！");

    //});
    window.addEventListener("unload", CallbackFunction);

    //初始化相关元素高度
    function init(){
        $("body").height($(window).height()-80);
        $("#iframe-main").height($(window).height()-90);
        $("#sidebar").height($(window).height()-50);
    }

    $(function(){
        init();
        $(window).resize(function(){
            init();
        });
    });

    // This function is called from the pop-up menus to transfer to
    // a different page. Ignore if the value returned is a null string:
    function goPage (newURL) {
        // if url is empty, skip the menu dividers and reset the menu selection to default
        if (newURL != "") {
            // if url is "-", it is this page -- reset the menu:
            if (newURL == "-" ) {
                resetMenu();            
            } 
            // else, send page to designated URL            
            else {  
                document.location.href = newURL;
            }
        }
    }

    // resets the menu selection upon entry to this page:
    function resetMenu() {
        document.gomenu.selector.selectedIndex = 2;
    }

    // uniform使用示例：
    // $.uniform.update($(this).attr("checked", true));
    </script>
</body>
</html>

